package digital_cash_system;

import javax.swing.JTextArea;

public class Logger
{
	private static String MessageSeparator = "\n";
	private static String CountMessageSeparator = ". ";
	
	private static Logger instance = new Logger();
	
	private JTextArea text;
	
	private int messageCount = 0;
	
	private Logger(){}
	
	public static Logger getInstance()
	{
		return instance;
	}
	
	public void initialize(JTextArea text)
	{
		this.text = text;
	}
	
	public void write(String message)
	{
		text.append(messageCount + CountMessageSeparator + message + MessageSeparator);
		messageCount++;
	}
}
